package org.eenie.appseed.ui.concatadapter

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.recyclerview.widget.ConcatAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import com.blankj.utilcode.util.ToastUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.listener.OnItemClickListener
import org.eenie.appseed.R
import org.eenie.appseed.databinding.ActivityConcatAdapterBinding
import org.eenie.core.base.viewbinding.BaseBindingActivity

class ConcatAdapterActivity : BaseBindingActivity<ActivityConcatAdapterBinding>() {


    private val mConcatAdapter by lazy {
        ConcatAdapter(mBannerHeaderAdapter, mGoodListAdapter)
    }

    private val mBannerHeaderAdapter = BannerHeaderAdapter()
    private val mGoodListAdapter = GoodListAdapter().apply {
        setNewInstance((1..100).map { it.toString() }.toMutableList())
    }


    override fun providerBinding() = ActivityConcatAdapterBinding.inflate(layoutInflater)

    override fun initUI() {
        binding.apply {
            rvConcat.layoutManager = LinearLayoutManager(mContext)
            rvConcat.adapter = mConcatAdapter

        }

        mBannerHeaderAdapter.setOnItemClickListener { _, _, position ->
            run {
                ToastUtils.showShort("banner item click $position")

            }
        }

        mGoodListAdapter.setOnItemClickListener { _, _, position ->
            run {
                ToastUtils.showShort("goods item click $position")

            }
        }


    }


}